<template>
    <bi-input v-model="value"  :loading="loading"  :before-width="70" :after-width="100" readonly  placeholder="请选择模板内包含的文件" >
        <template #before>
            <div class="text-bg-light border border-light" style="padding:2px 5px; border-radius: 5px; " >theme</div>
        </template>
        <template #after>
            <bi-button type="light" icon="fa-folder-open" @click="openDialog" >皮肤文件</bi-button>
        </template>
    </bi-input>
</template>

<script>
import fieldMixin from  '@@/admin/assets/bi-plug/fieldMixin.js';
export default{
    mixins:[fieldMixin],
    data(){
        return {
            loading:false
        }
    },
    methods:{
        openDialog(){
            this.loading = true;

            this.$ajax({
                url:this.$url({app:'web',controller:'admin.index',action:'getThemePath'}),
                success:(res)=>{
                    this.loading = false;
                    this.$admin.systemFile((value)=>{
                        this.value = value.file;
                    },{
                        title:'选择模板',
                        root:res.path,
                        ext:'*'
                    })
                },
                over:()=>{
                    this.loading = false;
                }
            });

        }
    }
}
</script>